package com.school.common.tags;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts2.components.Component;
import org.apache.struts2.views.jsp.ComponentTagSupport;

import com.opensymphony.xwork2.util.ValueStack;

public class PaginationTag extends ComponentTagSupport {
	private String pageNo;
	private String totalPageCount;
	private String totalRecordCount;
	private String styleClass;
	private String theme;
	private String url;
	private String urlType;

	public void setPageNo(String pageNo) {
		this.pageNo = pageNo;
	}

	public void setTotalPageCount(String totalPageCount) {
		this.totalPageCount = totalPageCount;
	}

	public void setTotalRecordCount(String totalRecordCount) {
		this.totalRecordCount = totalRecordCount;
	}

	public void setStyleClass(String styleClass) {
		this.styleClass = styleClass;
	}

	public void setTheme(String theme) {
		this.theme = theme;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	public void setUrlType(String urlType) {
		this.urlType = urlType;
	}

	@Override
	public Component getBean(ValueStack arg0, HttpServletRequest arg1, HttpServletResponse arg2) {
		return new Pagination(arg0, arg1);
	}

	protected void populateParams() {
		super.populateParams();

		Pagination pagination = (Pagination) component;
		pagination.setPageNo(pageNo);
		pagination.setTotalPageCount(totalPageCount);
		pagination.setTotalRecordCount(totalRecordCount);
		pagination.setStyleClass(styleClass);
		pagination.setTheme(theme);
		pagination.setUrl(url);
		pagination.setUrlType(urlType);

	}
}
